//package com.ybg.report.rtemplate.controller;
//import java.util.HashMap;
//import java.util.Map;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.ModelMap;
//import org.springframework.web.bind.annotation.ModelAttribute;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//import com.ybg.base.jdbc.BaseMap;
//import org.springframework.web.bind.annotation.RequestBody;
//import com.ybg.base.util.Json;
//import com.ybg.base.util.Page;
//import com.ybg.report.rtemplate.domain.RtemplateVO;
//import com.ybg.report.rtemplate.service.RtemplateService;
//import com.ybg.report.rtemplate.qvo.RtemplateQuery;
//import com.ybg.base.util.ValidatorUtils;
//import org.springframework.http.ResponseEntity;
//import org.springframework.http.HttpStatus;
//
///** @author Deament
// * @email 591518884@qq.com
// * @date 2018-02-21 */
//@Api("Rtemplate管理")
//@Controller
//@RequestMapping("/report/rtemplate_do/")
//public class RtemplateController {
//	
//	@Autowired
//	private RtemplateService rtemplateService;
//	
//	@ApiOperation(value = "Rtemplate管理页面", notes = "", produces = MediaType.TEXT_HTML_VALUE)
//	@RequestMapping(value = { "index.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public String index() {
//		return "/report/rtemplate/index";
//	}
//	
//	@ApiOperation(value = "Rtemplate分页列表", notes = "JSON ", produces = MediaType.APPLICATION_JSON_VALUE)
//	@ResponseBody
//	@RequestMapping(value = { "list.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public Page list(@ModelAttribute RtemplateQuery qvo, @ModelAttribute Page page, ModelMap map) throws Exception {
//		qvo.setBlurred(true);
//		page = rtemplateService.list(page, qvo);
//		page.init();
//		return page;
//	}
//	
//	@ApiOperation(value = "更新Rtemplate", notes = "", produces = MediaType.APPLICATION_JSON_VALUE)
//	@ResponseBody
//	@RequestMapping(value = { "update.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public Json update(@RequestBody RtemplateVO rtemplate) {
//		Json j = new Json();
//		j.setSuccess(true);
//		ValidatorUtils.validateEntity(rtemplate);
//		try {
//			BaseMap<String, Object> updatemap = new BaseMap<String, Object>();
//			updatemap.put("filename", rtemplate.getFilename());
//			updatemap.put("filecontent", rtemplate.getFilecontent());
//			BaseMap<String, Object> wheremap = new BaseMap<String, Object>();
//			wheremap.put("id", rtemplate.getId());
//			rtemplateService.update(updatemap, wheremap);
//		} catch (Exception e) {
//			e.printStackTrace();
//			j.setMsg("操作失败");
//			return j;
//		}
//		j.setMsg("操作成功");
//		return j;
//	}
//	
//	@ApiOperation(value = "根据ID删除rtemplate", notes = " ", produces = MediaType.APPLICATION_JSON_VALUE)
//	@ApiImplicitParam(name = "ids", value = "删除rtemplate", required = true, dataType = "java.lang.String")
//	@ResponseBody
//	@RequestMapping(value = { "remove.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public Json remove(@RequestParam(name = "ids", required = true) String ids2) {
//		Json j = new Json();
//		j.setSuccess(true);
//		try {
//			String[] ids = ids2.split(",");
//			for (String id : ids) {
//				BaseMap<String, Object> wheremap = new BaseMap<String, Object>();
//				wheremap.put("id", id);
//				rtemplateService.remove(wheremap);
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//			j.setMsg("操作失败");
//			return j;
//		}
//		j.setMsg("操作成功");
//		return j;
//	}
//	
//	@ApiOperation(value = "创建rtemplate", notes = " ", produces = MediaType.APPLICATION_JSON_VALUE)
//	@ResponseBody
//	@RequestMapping(value = { "create.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public Json create(@RequestBody RtemplateVO bean) {
//		Json j = new Json();
//		j.setSuccess(true);
//		ValidatorUtils.validateEntity(bean);
//		try {
//			rtemplateService.save(bean);
//		} catch (Exception e) {
//			e.printStackTrace();
//			j.setMsg("操作失败");
//			return j;
//		}
//		j.setMsg("操作成功");
//		return j;
//	}
//	
//	@ApiOperation(value = "获取单个Rtemplate", notes = "", produces = MediaType.APPLICATION_JSON_VALUE)
//	@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "java.lang.String") })
//	@RequestMapping(value = { "get.do" }, method = { RequestMethod.GET, RequestMethod.POST })
//	public ResponseEntity<Map<String, Object>> get(@RequestParam(name = "id", required = true) String id) throws Exception {
//		Map<String, Object> result = new HashMap<String, Object>();
//		RtemplateVO bean = rtemplateService.get(id);
//		result.put("rtemplate", bean);
//		ResponseEntity<Map<String, Object>> map = new ResponseEntity<Map<String, Object>>(result, HttpStatus.OK);
//		return map;
//	}
//}
